package com.iob.coin.DAO;

import com.iob.coin.po.KG;
import com.iob.coin.po.Node;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author: GuoXinyuan
 * @Date: 2021/3/14
 */

@Repository
public interface KGDAO extends JpaRepository<KG,String> {

    @Query(nativeQuery = true,value = "select * from se3.kg where id=?1")
    List<KG>kgById(int Id);

    @Query(nativeQuery = true,value = "select name from se3.kg where id=?1")
    String findNameById(int id);

    @Query(nativeQuery = true,value = "select * from se3.kg where user_id=?1")
    List<KG>findByUserId(int userid);

    void deleteById(int Id);

    @Query(nativeQuery = true,value = "select distinct name from se3.kg where user_id=?1")
    List<String>kgNameOfUser(int userid);

    @Query(nativeQuery = true,value = "select path from se3.kg where id=?1")
    String pathById(int kgId);

}
